<?php
declare (strict_types = 1);

namespace app\api\model\v1;

use think\Model;

/**
 * @mixin \think\Model
 */
class GatherFile extends AppModel
{
    const IS_ALLOT_ZERO = 0;
    const IS_ALLOT_ONE = 1;

    public static $is_allot = array(
        self::IS_ALLOT_ZERO => '未分配',
        self::IS_ALLOT_ONE => '已分配'
    );

    const IS_AUDIT_ONE = 1;
    const IS_AUDIT_TWO = 2;

    public static $is_audit = array(
        self::IS_AUDIT_ONE => '未审核',
        self::IS_AUDIT_TWO => '已审核'
    );


    //关联采集用户
    public function user(){
        return $this->belongsTo(Users::class,'user_id')->field('id,nickname');
    }
    //项目
    public function project(){
        return $this->belongsTo(Project::class,'project_id')->field('id,project_name');
    }
    //项目--一级指标
    public function projectType(){
        return $this->belongsTo(ProjectType::class,'project_type_id')->field('id,project_type_name');
    }
    //项目样本点
    public function projectSample(){
        return $this->belongsTo(ProjectSample::class,'project_sample_id')->field('id,title');
    }

    public function projectSecond(){
        return $this->belongsTo(ProjectSecondLevel::class,'project_second_level_id');
    }
    public function projectDetail(){
        return $this->belongsTo(ProjectDetail::class,'project_detail_id');
    }

    //文件夹表
    public function folder(){
        return $this->belongsTo(Folder::class,'folder_id')->field('id,title,sub_title');
    }
}
